--
-- Author: shunguo.chen
-- Date: 2016-10-20 15:51:48
--
-- RewardLevelVo

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

-- data = {
-- 	 level=,
--	 achId=,
-- }
function ClassRef:ctor(data)
	self.level = data.level
	self.achId = data.achId

	-- state -1(未开启) 0(未完成) 1(已完成) 2(已领取)
	self.state = -1
	local achieve = UD:getAchievement(data.achId)
	if achieve then
		self.state = achieve.state
	end

	local achConf = GD:getAchievementConfig(self.achId)
	local dropId = UD:parseClassText(achConf.drop)
	self.rewards = UD:parseDropToBagItem(dropId) or {}
end

function ClassRef:setState(state)
	self.state = state
end

function ClassRef:hasReward()
	return self.state == 1
end

function ClassRef:hasGot()
	return self.state == 2
end

return ClassRef
